home *** CD-ROM | disk | FTP | other *** search
- DEFINT A-Z
-
- '-------------------
- ' BLINDIN.BAS
- '-------------------
- ' To demonstrate a SUB that sends CHR$(176) to the screen instead
- ' of the key strokes entered by the operator -- as in the entry of
- ' a password, or any situation when what the operator is typing
- ' should not appear on the screen.
- '
- ' This sub is distributed as Shareware, wherein you can "Try Before
- ' You Buy." You are welcome to use the program for any period you
- ' feel appropriate to "Evaluate" it. (Even make copies and give to
- ' colleagues, provided you don't change anything or eliminate this
- ' explanatory message.
- '
- ' If you decide to really make use of this routine, you should
- ' register it with the author....
- '
- 'Kirk Woodward ∙ d/b/a People Centered Programs We accept Visa and MasterCard
- ' PO Box 610171 ∙ Dallas, TX 75261-0171 ∙ 817-488-4940 FAX: 817-488-4945
- '
- ' Your registration fee of $10 will bring you the current version of
- ' this routine AND a special BONUS SUB that you will find useful at
- ' no additional charge.
-
- DECLARE SUB BlindEnter (EnteredString$, Eline, Ecol)
-
- CLS
- SLEEP 1
-
- EnteredString$ = SPACE$(15)
- BlindEnter EnteredString$, 10, 35
-
- LOCATE 12, 17
- COLOR 7, 0
- PRINT "Operator Entered: ";
- COLOR 15, 0
- PRINT EnteredString$
-
- LOCATE 15, 15
- COLOR 14, 0
- PRINT "Any key re-runs the demo, ESC ends the demo."
- x$ = INPUT$(1)
-
- IF x$ <> CHR$(27) THEN RUN "blindin.bas"
-
- CLS
-
- OPEN "blindin.bas" FOR INPUT AS #1
- LINE INPUT #1, CommentLine$
- LINE INPUT #1, CommentLine$
- LINE INPUT #1, CommentLine$
- FOR x = 1 TO 22
- LINE INPUT #1, CommentLine$
- PRINT CommentLine$
- NEXT
-
- END
-
- SUB BlindEnter (EnteredString$, Eline, Ecol)
-
- ' Where: EnteredString$ = The "real" keystrokes operator made.
- ' Eline = The Line where the data is entered
- ' Ecol = The column where the data is entered
- '
- ' The SUB expects, at entry, for the EnteredString$ to be filled
- ' with spaces in order to set the maximum length of the field.
- '
- ' CHR$(176) = ░ is displayed in place of the actual key stroke
- ' but can be changed to anything you like in the code below.
- '
- ' There is NO error checking to determine if the field can be
- ' be displayed properly.
- '
- ' The only `editing' key that is accepted is the backspace key.
-
- LOCATE Eline - 1, 1
- PRINT "Enter some data . . ."
- LOCATE Eline, Ecol
- COLOR 0, 7 ' print black on white
- PRINT EnteredString$
- FieldLength = LEN(EnteredString$)
- EnteredString$ = ""
-
- DO
-
- DO
- K$ = INKEY$
- LOOP UNTIL K$ > ""
-
- K$ = UCASE$(K$)
-
-
- SELECT CASE K$
-
- CASE CHR$(13) ' enter key pressed
- EXIT SUB
-
- ' It is within
- ' this block that you could make further constraints on
- ' on what would be accepted by the routine. As written
- ' everything above CHR$(31) is accepted.
- '
- ' If you plan extensive use of this routine (more than
- ' just a few keystrokes) you will likely want to make
- ' provision for the routine to deal with more editing
- ' keys than just the backspace key.
-
- CASE CHR$(8) ' backspace key was pressed
-
- IF LEN(DisplayString$) >= 1 THEN
- DisplayString$ = LEFT$(DisplayString$, LEN(DisplayString$) - 1)
- EnteredString$ = LEFT$(EnteredString$, LEN(EnteredString$) - 1)
- ELSE
- BEEP
- END IF
-
- CASE ELSE
- IF K$ >= CHR$(32) THEN
- EnteredString$ = EnteredString$ + K$
- DisplayString$ = DisplayString$ + CHR$(176)
- ELSE
- BEEP
- END IF
-
- END SELECT
-
- LOCATE Eline, Ecol: PRINT SPACE$(FieldLength)
- LOCATE Eline, Ecol: PRINT DisplayString$
- IF LEN(EnteredString$) = FieldLength THEN EXIT SUB
-
- LOOP
-
-
-
-
- END SUB
-
-